import os

# 设置路径
path = r"E:\ISAT_with_segment_anything\ISAT_with_segment_anything\ISAT\self\WIN_20250302_03_03_22_Pro-"  # 替换为你的实际路径
tag = "WIN_20250302_03_03_22_Pro"

# 获取所有文件
files = os.listdir(path)

# 遍历文件并重命名
for file in files:
    if file.startswith("frame_") and (file.endswith(".png") or file.endswith(".json")):
        old_path = os.path.join(path, file)
        new_name = file.replace("frame_", f"{tag}_", 1)
        new_path = os.path.join(path, new_name)
        os.rename(old_path, new_path)
        print(f"Renamed: {old_path} -> {new_path}")

print("批量重命名完成！")
